//
//  NetworkManager.h
//  MIHelloNetwork101
//
//  Created by on 13-1-21.
//  Copyright (c) . All rights reserved.
//

#import <Foundation/Foundation.h>
#import "NetworkTask.h"
#import "../ASIHttpRequest/ASINetworkQueue.h"
#import "DownloadCarObj.h"
typedef enum {
    NetworkManagerTaskLevel_Low = 6000,//如下载table view中cell的icon，加载失败或等很久也没关系的
    NetworkManagerTaskLevel_Middle,//如下载音频、大图片等允许排队的
    NetworkManagerTaskLevel_NotBlocking,//如UI需要的数据，用户在等待，不允许阻塞的
}NetworkManagerTaskLevel;

@interface NetworkManager : NSObject{
    @private
    NSMutableArray *taskArray;//任务队列
    ASINetworkQueue *iLowLevelNetworkQueue;
    ASINetworkQueue *iMiddleLevelNetworkQueue;
}
@property (retain, nonatomic) NSString* host;
+ (NetworkManager*)getInstance;

- (BOOL)startTaskAsync:(NetworkTask*)task; // 默认都是不阻塞的
- (BOOL)startTaskAsync:(NetworkTask*)task level:(NetworkManagerTaskLevel)level;
- (void)cancelTaskByIndentifier:(NSString*)taskIndentifier;

//根据URL得到DownLoadObject，这个DownLoadObject可能是已经下载了一部分的对象
-(DownloadCarObj *)GetDownLoadObjectWithName:(NSString*)fileName URL:(NSString *)urlstring;

@end
